home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / infop125.zip / PAGE_16.INC < prev    next >
Text File  |  1990-08-10  |  6KB  |  204 lines

  1. procedure page_16;
  2.   var
  3.     bootrec : array[0..secsiz - 1] of byte;
  4.     i : 1..26;
  5.     j : word;
  6.     l : longint;
  7.     xbool : boolean;
  8.     xbyte : byte;
  9.     xchar : char;
  10.     xword1 : word;
  11.     xword2 : word;
  12.     xword3 : word;
  13.     xword4 : word;
  14.     xword5 : word;
  15.  
  16.   begin
  17.   window(1, 3, twidth div 2, tlength - 2);
  18.   caption1('Boot record of ');
  19.   drvname(currdrv);
  20.   writeln;
  21.   xword1:=diskread(currdrv, 0, 1, bootrec);
  22.   if xword1 = $0000 then
  23.     begin
  24.     media(bootrec[$15], bootrec[$0D]);
  25.     caption3('Sectors/cluster');
  26.     writeln(bootrec[$0D]);
  27.     caption3('Bytes/sector');
  28.     writeln(cbw(bootrec[$0B], bootrec[$0C]));
  29.     caption3('Reserved sectors');
  30.     writeln(cbw(bootrec[$0E], bootrec[$0F]));
  31.     caption3('FAT''s');
  32.     writeln(bootrec[$10]);
  33.     caption3('Sectors/FAT');
  34.     writeln(cbw(bootrec[$16], bootrec[$17]));
  35.     caption3('Root directory entries');
  36.     writeln(cbw(bootrec[$11], bootrec[$12]));
  37.     writeln;
  38.     caption3('Heads');
  39.     writeln(cbw(bootrec[$1A], bootrec[$1B]));
  40.     caption3('Total sectors');
  41.     xword1:=bootrec[$13] + word(bootrec[$14] shl 8);
  42.     if xword1 = 0 then
  43.       begin
  44.       l:=bootrec[$20] + (bootrec[$21] * $100) +
  45.         (bootrec[$22] * $10000) + (bootrec[$23] * $1000000);
  46.       Writeln(l)
  47.       end
  48.     else
  49.       writeln(cbw(bootrec[$13], bootrec[$14]));
  50.     caption3('Sectors/track');
  51.     writeln(cbw(bootrec[$18], bootrec[$17]));
  52.     caption3('Hidden sectors');
  53.     if xword1 = 0 then
  54.       begin
  55.       l:=bootrec[$1C] + (bootrec[$1D] * $100) +
  56.         (bootrec[$1E] * $10000) + (bootrec[$1F] * $1000000);
  57.       Writeln(l)
  58.       end
  59.     else
  60.       writeln(cbw(bootrec[$1C], bootrec[$1D]));
  61.     caption3('OEM name and version');
  62.     for i:=$03 to $0A do
  63.       write(showchar(chr(bootrec[i])));
  64.     writeln;
  65.     caption3('Extended boot record');
  66.     if (osmajor >= 4) and (bootrec[$26] = $29) then
  67.       begin
  68.       Writeln('yes');
  69.       caption3('Physical drive number');
  70.       Writeln(bootrec[$24]);
  71.       caption3('Volume label');
  72.       for j:=$2B to $35 do
  73.         Write(showchar(Chr(bootrec[j])));
  74.       Writeln;
  75.       caption3('Serial Number');
  76.       Writeln(hex(cbw(bootrec[$29], bootrec[$2A]), 4), '-',
  77.         hex(cbw(bootrec[$27], bootrec[$28]), 4));
  78.       caption3('FAT type');
  79.       for j:=$36 to $3D do
  80.         Write(showchar(Chr(bootrec[j])))
  81.       end
  82.     else
  83.       Writeln('no')
  84.     end
  85.   else
  86.     begin
  87.     writeln('  Can''t read boot record');
  88.     write('  ');
  89.     xbyte:=hi(xword1);
  90.     case xbyte of
  91.       $80 : writeln('Attachment failed to respond');
  92.       $40 : writeln('Seek operation failed');
  93.       $20 : writeln('Controller failed');
  94.       $10 : writeln('Data error (bad CRC)');
  95.       $08 : writeln('DMA failure');
  96.       $04 : writeln('Sector not found');
  97.       $03 : writeln('Write-protect fault');
  98.       $02 : writeln('Bad address mark');
  99.       $01 : writeln('Bad command');
  100.       $00 : writeln
  101.       else
  102.         unknown('error', xbyte, 2)
  103.     end;
  104.     write('  ');
  105.     xbyte:=lo(xword1);
  106.     case xbyte of
  107.       $00 : writeln('Write-protect error');
  108.       $01 : writeln('Unknown unit');
  109.       $02 : writeln('Drive not ready');
  110.       $03 : writeln('Unknown command');
  111.       $04 : writeln('Data error (bad CRC)');
  112.       $05 : writeln('Bad request structure length');
  113.       $06 : writeln('Seek error');
  114.       $07 : writeln('Unknown media type');
  115.       $08 : writeln('Sector not found');
  116.       $09 : writeln('Printer out of paper');
  117.       $0A : writeln('Write fault');
  118.       $0B : writeln('Read fault');
  119.       $0C : writeln('General failure')
  120.       else
  121.         unknown('error', xbyte, 2)
  122.     end
  123.     end;
  124.   window(1 + twidth div 2, 3, twidth, tlength - 2);
  125.   i:=1;
  126.   xbool:=false;
  127.   xword1:=memw[devseg : devofs + $0018];
  128.   xword2:=memw[devseg : devofs + $0016];
  129.   repeat
  130.     if osmajor >= 4 then
  131.       xbyte:=1
  132.     else
  133.       xbyte:=0;
  134.     caption1('DOS disk parameter block for ');
  135.     drvname(i - 1);
  136.     writeln;
  137.     xword3:=memw[xword1 : xword2 + $0047];
  138.     xword4:=memw[xword1 : xword2 + $0045];
  139.     media(mem[xword3 : xword4 + $0016 + xbyte],
  140.           mem[xword3 : xword4 + $0004] + 1);
  141.     caption3('Sectors/cluster');
  142.     writeln(mem[xword3 : xword4 + $0004] + 1);
  143.     caption3('Bytes/sector');
  144.     writeln(memw[xword3 : xword4 + $0002]);
  145.     caption3('Reserved sectors');
  146.     writeln(memw[xword3 : xword4 + $0006]);
  147.     caption3('FAT''s');
  148.     writeln(mem[xword3 : xword4 + $0008]);
  149.     caption3('Sectors/FAT');
  150.     if osmajor >= 4 then
  151.       Writeln(Mem[xword3:xword4 + $000F] +
  152.           (Mem[xword3:xword4 + $0010] * 256))
  153.     else
  154.       writeln(mem[xword3 : xword4 + $000F]);
  155.     caption3('Root directory entries');
  156.     writeln(memw[xword3 : xword4 + $0009]);
  157.     writeln;
  158.     caption3('DPB valid');
  159.     yesorno(mem[xword3 : xword4 + $0017 + xbyte] < $FF);
  160.     caption3('Current directory');
  161.     j:=xword2;
  162.     xchar:=chr(mem[xword1 : j]);
  163.     while xchar > #0 do begin
  164.       write(xchar);
  165.       inc(j);
  166.       xchar:=chr(mem[xword1 : j])
  167.     end;
  168.     writeln;
  169.     caption3('Device header');
  170.     segofs(memw[xword3 : xword4 + $0014 + xbyte],
  171.       memw[xword3 : xword4 + $0012 + xbyte]);
  172.     writeln;
  173.     caption3('Unit within driver');
  174.     writeln(mem[xword3 : xword4 + $0001]);
  175.     caption3('Clusters');
  176.     writeln(memw[xword3 : xword4 + $000D] - 1);
  177.     caption3('Cluster to sector shift');
  178.     writeln(mem[xword3 : xword4 + $0005]);
  179.     caption3('Root directory sector');
  180.     writeln(memw[xword3 : xword4 + $0010 + xbyte]);
  181.     caption3('First data sector');
  182.     writeln(memw[xword3 : xword4 + $000B]);
  183.     caption3('Next DPB');
  184.     xword5:=memw[xword3 : xword4 + $0018 + xbyte];
  185.     segofs(memw[xword3 : xword4 + $001A + xbyte], xword5);
  186.     writeln;
  187.     if (i < lastdrv) and (xword5 < $FFFF) then
  188.       begin
  189.       write('  ');
  190.       pause1;
  191.       if endit then
  192.         Exit;
  193.       clrscr;
  194.       inc(i);
  195.       if osmajor >= 4 then
  196.         Inc(xword2, $58)
  197.       else
  198.         inc(xword2, $51)
  199.       end
  200.     else
  201.       xbool:=true
  202.   until xbool
  203.   end;
  204.